function _typeof(obj) {
  '@babel/helpers - typeof';
  return (
    (_typeof =
      'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
        ? function (obj) {
            return typeof obj;
          }
        : function (obj) {
            return obj &&
              'function' == typeof Symbol &&
              obj.constructor === Symbol &&
              obj !== Symbol.prototype
              ? 'symbol'
              : typeof obj;
          }),
    _typeof(obj)
  );
}
var _excluded = ['code', 'asPage', 'belong', 'manager', 'mobile', 'children'];
function _extends() {
  _extends = Object.assign
    ? Object.assign.bind()
    : function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];
          for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }
        return target;
      };
  return _extends.apply(this, arguments);
}
function _defineProperty(obj, key, value) {
  key = _toPropertyKey(key);
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true,
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
function _toPropertyKey(arg) {
  var key = _toPrimitive(arg, 'string');
  return _typeof(key) === 'symbol' ? key : String(key);
}
function _toPrimitive(input, hint) {
  if (_typeof(input) !== 'object' || input === null) return input;
  var prim = input[Symbol.toPrimitive];
  if (prim !== undefined) {
    var res = prim.call(input, hint || 'default');
    if (_typeof(res) !== 'object') return res;
    throw new TypeError('@@toPrimitive must return a primitive value.');
  }
  return (hint === 'string' ? String : Number)(input);
}
function _objectWithoutProperties(source, excluded) {
  if (source == null) return {};
  var target = _objectWithoutPropertiesLoose(source, excluded);
  var key, i;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
    for (i = 0; i < sourceSymbolKeys.length; i++) {
      key = sourceSymbolKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
      target[key] = source[key];
    }
  }
  return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
  if (source == null) return {};
  var target = {};
  var sourceKeys = Object.keys(source);
  var key, i;
  for (i = 0; i < sourceKeys.length; i++) {
    key = sourceKeys[i];
    if (excluded.indexOf(key) >= 0) continue;
    target[key] = source[key];
  }
  return target;
}
import { Result as AntdResult } from 'antd';
import 'antd/es/button/style/index.js';
import 'antd/es/result/style/index.js';
import classnames from 'classnames';
import React from 'react';
import img_403 from './imgs/403.png';
import img_404 from './imgs/404.png';
import img_500 from './imgs/500.png';
import buildingImg from './imgs/building.png';
import networkErrorImg from './imgs/network-error.png';
import './index.less';
var imgs = [
  {
    code: '403',
    image: img_403,
    title: '抱歉，您暂无访问权限',
    subTitle: '请联系管理员',
  },
  {
    code: '404',
    image: img_404,
    title: '抱歉，系统错误',
    subTitle: '请尝试清除缓存或联系管理员',
  },
  {
    code: '500',
    image: img_500,
    title: '抱歉，系统错误',
    subTitle: '请尝试清除缓存或联系管理员',
  },
  {
    code: 'network-error',
    image: networkErrorImg,
    title: '网络错误',
    subTitle: '请检查网络连接是否正常',
  },
  {
    code: 'building',
    image: buildingImg,
    title: '正在建设中',
    subTitle: '敬请期待',
  },
];

/**
 * 结果
 */
export default function Result(_ref) {
  var code = _ref.code,
    _ref$asPage = _ref.asPage,
    asPage = _ref$asPage === void 0 ? true : _ref$asPage,
    belong = _ref.belong,
    manager = _ref.manager,
    mobile = _ref.mobile,
    children = _ref.children,
    rest = _objectWithoutProperties(_ref, _excluded);
  var found = imgs.find(function (img) {
    return img.code === code;
  });
  return /*#__PURE__*/ React.createElement(
    AntdResult,
    _extends(
      {
        icon:
          found !== null && found !== void 0 && found.image
            ? /*#__PURE__*/ React.createElement('img', {
                src: found === null || found === void 0 ? void 0 : found.image,
                title: found === null || found === void 0 ? void 0 : found.title,
              })
            : undefined,
        title: found === null || found === void 0 ? void 0 : found.title,
        subTitle: found === null || found === void 0 ? void 0 : found.subTitle,
        extra:
          belong && manager && mobile
            ? /*#__PURE__*/ React.createElement(
                'div',
                {
                  className: 'szzj-result-zzd-extra',
                },
                /*#__PURE__*/ React.createElement(
                  'div',
                  {
                    className: 'szzj-result-zzd-extra-item',
                  },
                  /*#__PURE__*/ React.createElement(
                    'div',
                    {
                      className: 'szzj-result-zzd-extra-item-label',
                    },
                    '\u5E94\u7528\u5F52\u5C5E\u5355\u4F4D',
                  ),
                  /*#__PURE__*/ React.createElement(
                    'div',
                    {
                      className: 'szzj-result-zzd-extra-item-value',
                    },
                    belong,
                  ),
                ),
                /*#__PURE__*/ React.createElement(
                  'div',
                  {
                    className: 'szzj-result-zzd-extra-item',
                  },
                  /*#__PURE__*/ React.createElement(
                    'div',
                    {
                      className: 'szzj-result-zzd-extra-item-label',
                    },
                    '\u5E94\u7528\u7BA1\u7406\u5458',
                  ),
                  /*#__PURE__*/ React.createElement(
                    'div',
                    {
                      className: 'szzj-result-zzd-extra-item-value',
                    },
                    manager,
                  ),
                ),
                /*#__PURE__*/ React.createElement(
                  'div',
                  {
                    className: 'szzj-result-zzd-extra-item',
                  },
                  /*#__PURE__*/ React.createElement(
                    'div',
                    {
                      className: 'szzj-result-zzd-extra-item-label',
                    },
                    '\u8054\u7CFB\u65B9\u5F0F',
                  ),
                  /*#__PURE__*/ React.createElement(
                    'div',
                    {
                      className: 'szzj-result-zzd-extra-item-value',
                    },
                    mobile,
                  ),
                ),
              )
            : null,
      },
      rest,
      {
        className: classnames(
          'szzj-result',
          _defineProperty(
            {
              page: !!asPage,
            },
            rest.className,
            !!rest.className,
          ),
        ),
      },
    ),
    children,
  );
}
